import request from "@/utils/request";

export default {
    userRegister(username, password) {
        const data = {
            username,
            password
        }
        return request(
            {
                url: "user/register",
                method: "post",
                data: data
            }
        )
    },
    loginByPassword(username, password) {
        const data = {
            username,
            password
        }
        return request({
            url: "user/login",
            method: "post",
            data: data,
        })
    },
    getCode(phone) {
        return request(
            {
                url: "user/getCode",
                method: "get",
                params: {
                    phone: phone
                }
            }
        )
    },
    validateCode(phone, code) {
        return request(
            {
                url: "user/validateCode",
                method: "get",
                params: {
                    phone: phone,
                    code: code
                }
            }
        )
    },
    getInfo() {
        return request(
            {
                url: "user/getUserInfo",
                method: "get",
            }
        )
    },
    getAllInfo() {
        return request(
            {
                url: "user/getAllUserInfo",
                method: "get",
            }
        )
    }

}
